{% extends "base.html" %}
{% block head %}
    {{ super() }}
  <link rel="stylesheet" href="{{ url_for('static', filename='css/pending.css')}}">
{% endblock %}
{% block content %}
    <div class="row module-title">
        <div style="margin-top:30px;" class="col-md-2">
            <span class='sub-title'>交易记录</span>
        </div>
    </div>
    {% for drift in drifts %}
        <div style="margin-top:20px;" class="row drift-container">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-2">
                        <img class="book-img-small shadow" src="{{ drift.book_img }}">
                    </div>
                    <div style="margin-left:-30px;"
                         class="col-md-8 flex-vertical description">
                        <div><span>书籍名：</span><span>{{ drift.book_title }}</span></div>
                        <div><span>作者：</span><span>{{ drift.book_author }}</span></div>
                        <div><span>发起日期：</span><span>{{ drift.date }}</span></div>
                        <div>
                            {% if drift.you_are == 'requester' %}
                                <span>向他请求：</span>
                            {% else %}
                                <span>请求者：</span>
                            {% endif %}
                            <span>{{ drift.operator }}</span>
                        </div>
                        <div><span>状态：</span><span
                                class="status-color">{{ drift.status_str }}</span></div>
                        <div><span>邮寄地址：</span><span
                                class="space">{{ drift.recipient_name }}</span><span>{{ drift.address }}</span>
                        </div>
                        <div><span>联系电话：</span><span>{{ drift.mobile }}</span></div>
                    </div>
                    <div class="col-md-2 flex-vertical">
                        {% if drift.you_are == 'gifter' %}
                            {% if drift.status.value == 1 %}
                                <a href="{{ url_for('web.mailed_drift', did=drift.drift_id) }}">
                                    <span class="btn-normal">已邮寄</span>
                                </a>
                                <a style="margin-top:20px;" href="{{ url_for('web.reject_drift', did=drift.drift_id) }}">
                                    <span class="btn-shadow">拒&nbsp;&nbsp;&nbsp;绝</span>
                                </a>
                            {% endif %}
                        {% endif %}
                        {% if drift.you_are == 'requester' %}
                            {% if drift.status.value == 1 %}
                                <a href="{{ url_for('web.redraw_drift', did=drift.drift_id) }}">
                                        <span class="btn-normal">撤 销</span>
                                </a>
                            {% endif %}
                        {% endif %}
                    </div>
                </div>
                <div style="margin-top:20px;" class="row message-container">
                    <div class="col-md-12">
                        {% if drift.you_are == 'receiver' %}
                            {% set message_flag = '他的留言：' %}
                        {% else %}
                            {% set message_flag = '你的留言：' %}
                        {% endif %}
                        <p><span
                                class="message-flag">{{ message_flag }}</span>
                            <span>{{ drift.message }}</span>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
{% endblock %}